<template>
  <div class="itemMusicList">
    <div class="topMenu">
      <svg class="icon" aria-hidden="true">
        <use xlink:href="#icon-bofang"></use>
      </svg>
      <div class="playAll">
        播放全部
        <span>(共20首)</span>
      </div>
      <button class="collect"><span>+</span>收藏(3561)</button>
    </div>
    <div class="musicList">
      <list-container :MusicListDetail="MusicListDetail"></list-container>
      <!-- <ul class="listContainer">
        <li class="musicItem" v-for="(item, index) in MusicListDetail" :key="index">
          <div class="leftMessage" @click="playMusic(index)">
            <span>{{ index + 1 }}</span>
            <div class="songMessage">
              <div class="songName">{{ item.name }}</div>
              <div class="songCreator">
                <div class="creator" v-for="(creator, index) in item.ar" :key="index">{{ creator.name }}</div>
              </div>
            </div>
          </div>
          <div class="mvIcon">
            <svg class="icon" aria-hidden="true" v-if="item.mv != 0" style="margin-right:15px">
              <use xlink:href="#icon-bofang"></use>
            </svg>
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-caidan1"></use>
            </svg>
          </div>

        </li>
      </ul> -->
    </div>

  </div>
</template>

<script>
import { mapMutations } from 'vuex'
import ListContainer from './child/ListContainer.vue'
export default {
  components: {
    ListContainer
  },
  props: ['MusicListDetail', 'subscribedCount'],
  methods: {
    playMusic(index) {
      this.updatePlayList(this.MusicListDetail)
      this.updatePlayListIndex(index)
      this.updatePlayStatus(true)
    },
    ...mapMutations(['updatePlayList', 'updatePlayListIndex', 'updatePlayStatus'])
  }
}
</script>

<style lang="less">
.itemMusicList {
  width: 100%;
  overflow: auto;
  min-height: 10rem;
  background-color: white;
  padding: .2rem 0.1rem;
  margin-top: .4rem;
  border-top-left-radius: .4rem;
  border-top-right-radius: .4rem;
  box-shadow: 0px 2px 12px 2px rgba(190, 190, 190, 0.517);

  .topMenu {
    display: flex;
    justify-content: space-around;
    align-items: center;

    .icon {
      width: .5rem;
      height: .5rem;
    }

    .playAll {
      font-size: 15px;
      font-weight: bold;
      display: flex;
      align-items: center;
    }

    span {
      color: gray;
      font-weight: normal;
      font-size: 13px;
      margin-left: 3px;
    }

    .collect {
      width: 110px;
      height: 30px;
      border-radius: 30px;
      background-color: rgb(52, 215, 155);
      outline: none;
      color: white;
      border: none;
      line-height: 30px;

      span {
        font-size: 20px;
        margin-right: 5px;
        color: white;
        font-family: 'Courier New', Courier, monospace;
      }
    }
  }

  .musicList {

    .listContainer {
      padding-bottom: 1rem;

      .musicItem {
        display: flex;
        margin: 5px 0;
        justify-content: space-between;
        align-items: center;
        height: 50px;

        .leftMessage {
          display: flex;
          align-items: center;

          span {
            margin-right: 15px;
          }

          .songMessage {
            .songName {
              width: 250px;
              font-weight: bold;
              font-size: 14px;
              white-space: nowrap;
              overflow: hidden;
              text-overflow: ellipsis;
            }

            .songCreator {
              display: flex;
              color: gray;
              font-size: 13px;

              .creator {
                &:nth-child(n+2) {
                  margin: 0 8px;
                }
              }
            }
          }
        }
      }
    }
  }
}
</style>